/**
 * 
 */
package com.ez.supervise.service.impl;

import java.util.List;

import com.ez.supervise.core.Page;
import com.ez.supervise.dao.CmsDao;
import com.ez.supervise.model.biz.Cms;
import com.ez.supervise.service.CmsService;

/**
 * @author searph.wang
 * @email searph.wang@gmail.com
 * @Created at 2009-7-22
 * 
 */
public class CmsServiceImpl implements CmsService {
    private CmsDao cmsDao;

    public void setCmsDao(CmsDao cmsDao) {
	this.cmsDao = cmsDao;
    }

    /*
     * (non-Javadoc)
     * 
     * @see com.ez.supervise.service.base.BaseService#delete(java.lang.Long)
     */
    public void delete(Long id) {
	cmsDao.delete(id);
    }

    /*
     * (non-Javadoc)
     * 
     * @see com.ez.supervise.service.base.BaseService#insert(java.lang.Object)
     */
    public void insert(Object entity) {
	cmsDao.insert(entity);

    }

    /*
     * (non-Javadoc)
     * 
     * @see com.ez.supervise.service.base.BaseService#update(java.lang.Object)
     */
    public void update(Object entity) {
	cmsDao.update(entity);
    }

    /*
     * (non-Javadoc)
     * 
     * @see com.ez.supervise.service.base.BaseService#get(java.lang.Long)
     */
    public Object get(Long id) {
	return (Cms) cmsDao.get(id);
    }

    /*
     * (non-Javadoc)
     * 
     * @see
     * com.ez.supervise.service.CmsService#findByPage(com.ez.supervise.core.
     * Page)
     */
    public Page findCmsByPage(Page page) {
	page.setRoot(cmsDao.findCmsByPage(page));
	page.setTotalProperty(cmsDao.findCmsByCount(page));
	return page;

    }

    /*
     * (non-Javadoc)
     * 
     * @see com.ez.supervise.service.CmsService#findAll()
     */
    public List findAll() {
	return cmsDao.findAll();
    }

    public List findCmsByPublish() {
	return cmsDao.findCmsByPublish();
	
    }

    public void publish(List idList, String publishStatus) {
	for(Object id: idList){
	    cmsDao.publish((Long)id, publishStatus);
	}
    }
}
